package com.codeoss.framework.db.service.impl;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

import com.codeoss.framework.db.service.IDDLService;

@Service
public class DDLServiceStore implements IDDLServiceStore,ApplicationContextAware {
	@Value("${framework.db-type}")
	private String dbType;
	private ApplicationContext applicationContext;
	
	@Override
	public IDDLService getDDLService() {
		// TODO Auto-generated method stub
		IDDLService ddlService=(IDDLService)applicationContext.getBean(dbType+"DDLService");
		return ddlService;
	}
	
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		// TODO Auto-generated method stub
		this.applicationContext=applicationContext;
	}

}
